//
//  Downloader.h
//  MobileZIPCodes
//
//  Created by Andreas Schwelling on 06.12.07.
//	http://www.andi.de/zipcodes/
// 
//  Released under the GNU General Public License.
//  See LICENSE for details.
//
//  Use at your own risk.
//


#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
#import <UIKit/CDStructures.h>
#import <UIKit/UIWindow.h>
#import <UIKit/UIView-Hierarchy.h>
#import <UIKit/UIHardware.h>
#import <UIKit/UIKit.h>
#import <UIKit/UIApplication.h>
#import <UIKit/UITextView.h>
#import <UIKit/UIView.h>
#import <UIKit/UIKeyboard.h>
#import <UIKit/UIBox.h>

@class PreferencesView;

@interface Downloader : NSObject
{
	NSString * url, * file;
	int expectedBytes;
	int loadedBytes;
	int loadercycle;
	NSURL * nsurl;
	BOOL failed, finished;
	NSMutableData * data;
	NSString * trig;
	PreferencesView *app;
}

+ (id) downloadURL: (NSString *)url to: (NSString *)filename delegate: (id) delegate;
- (id) initWithDownloadURL: (NSString *)url savingToFile: (NSString *)filename delegate: (id)delegate;
- (float) getProgress;
- (BOOL) finished;
- (BOOL) failed;

- (void)URL:(NSURL *)sender resourceDataDidBecomeAvailable:(NSData *)newBytes;
- (void)URL:(NSURL *)sender resourceDidFailLoadingWithReason:(NSString *)reason;
- (void)URLResourceDidCancelLoading:(NSURL *)sender;
- (void)URLResourceDidFinishLoading:(NSURL *)sender;

@end
